<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="field[@type = 'captcha' and parent::doctype]" mode="dtf_error">
		<xsl:variable name="is_new" select="parent::doctype/@action = 'create'"/>
		<xsl:variable name="document_field" select="../../document[@doctype_name = current()/parent::doctype/@name]/field[@name = current()/@name]"/>
		<xsl:if test="../../pass_info/error[@field_name = current()/@name]">
			<xsl:choose>
				<xsl:when test="../../pass_info/error[@field_name = current()/@name and @name = 'NO_RECAPTCHA_PUBLIC_KEY']">
					<div class="error">
						<span>No recaptcha public key in your config</span>
					</div>
				</xsl:when>
				<xsl:when test="../../pass_info/error[@field_name = current()/@name and @name = 'NO_RECAPTCHA_PRIVATE_KEY']">
					<div class="error">
						<span>No recaptcha private key in your config</span>
					</div>
				</xsl:when>
				<xsl:when test="../../pass_info/error[@field_name = current()/@name and @name = 'INCORRECT_CAPTCHA']">
					<div class="error">
						<span>
							<xsl:text>Вы ввели некорректный код. Пожалуйста, попробуйте ещё раз.</xsl:text>
							<!-- Technical info. It's not for our user -->
							<!--<xsl:text> (Server response: </xsl:text>
								<xsl:value-of select="../../pass_info/error[@field_name = current()/@name and @name = 'INCORRECT_CAPTCHA']" />
							<xsl:text>)</xsl:text>-->
						</span>
					</div>
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
